<?php
//zengke
header("Content-type: text/html; charset=utf-8");
define('IN_SERVER', TRUE);
define('DIR_ROOT', substr(str_replace("\\",'/',dirname(__FILE__)),0,-7));

require_once 'configs/config.inc.php';
require_once 'configs/server.php';

if(RELEASE) {
	error_reporting(0);
	ini_set("display_errors", "off");
} else { // test
	error_reporting(E_ALL);
	ini_set("display_errors", "on");
}

$classCName = $_GET['controller'];
$method = isset($_GET['method']) ? $_GET['method'] : "index";

if ( !$classCName || !$method ) {
	echo "controller or method is null";
	exit();	
}

if(file_exists('controllers/'.$classCName . ".php")) {
	require_once ('controllers/'.$classCName . ".php");
	/*
	 * 包含额外语言
	 * 示例: $chs = lng("chs");
	 * 注意: 尽量保证$chs有效，可以减少include次数而增加性能
	*/
	function __autoload($classname) {
		require_once ('model/'.$classname . ".php");
	}
	
	$objC = new $classCName;
	
	
	
	if(method_exists($classCName, $method)) return $objC -> $method();
	else echo "class： {$classCName} not has method {$method}";
} else {
	echo 'no file';
}
?>